//模拟一下Promise.none，在这个函数中，只要有一个成功则拒绝，所有都拒绝时则成功
Promise.none = function (promises) {
    return new Promise((resolve, reject) => {
        let successNum = 0;
        let errorNum = 0;
        promises.forEach(function (pr) {
            Promise.resolve(pr).then(
                function fulfilled() {
                    successNum++;
                    checkResult();
                },
                function rejected() {
                    errorNum++
                    checkResult();
                }
            )
        })
        function checkResult() {
            if (successNum + errorNum === promises.length) {
                if (errorNum === promises.length) {
                    resolve("no seccess");
                } else {
                    reject("have success");
                }
            }
        }
    });
}

Promise.none([{
    then:function(resolve,reject){
        reject("hi");
    }
},89])
.then(
    function(value){
        console.log(value);
    },
    function(value){
        console.log(value);
    }
)